﻿@model ChampionFramework.Models.Tatica
@{
    ViewBag.Title = "CreateTatics";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section scripts {
    <script src="../../Scripts/TaticaDragDrop.js" type="text/javascript"></script>
}
<h2>
    CreateTatics</h2>
@using (Html.BeginForm("CreateTaticsPost", "Tatica"))
{

    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Tática</legend>
        <div class="editor-label">
            @Html.LabelFor(m => m.Nome)
        </div>
        <div class="editor-field">
            @Html.EditorFor(m => m.Nome)
        </div>
        <div class="div_campo_com_borda">
            <div class="div_tatica_campo" ondrop="drop(event)" ondragover="allowDrop(event)">
                @for (int i = 0; i < Model.PosicionamentoTatico.Count; i++)
                {
                    var pos = Model.PosicionamentoTatico.ElementAt(i);
                    <div class="editor-field">
                        @Html.Hidden(String.Format("{0}X", i), pos.X)
                    </div>            
                    <div class="editor-field">
                        @Html.Hidden(String.Format("{0}Y", i), pos.Y)
                    </div>
                    <div id="@i" class="div_posicionamento_tatico moveable" draggable="true" 
                 style="left: @String.Format("{0}px;", pos.X); top: @String.Format("{0}px;", pos.Y)">
                    </div>
                }
            </div>
        </div>
        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}
